/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DLL;

/**
 *
 * @author PyyPyLyn
 */
import java.io.IOException;
import java.net.*;

public class InitializationBroadCastGroup {
    
    private InetAddress _group;
    private int _portWait;
    private MulticastSocket m_Group;

    /**
     * @return the _group
     */
    public InetAddress getGroup() {
        return _group;
    }

    /**
     * @param group the _group to set
     */
    public void setGroup(InetAddress group) {
        this._group = group;
    }

    /**
     * @return the _portWait
     */
    public int getPortWait() {
        return _portWait;
    }

    /**
     * @param port the _portWait to set
     */
    public void setPortWait(int port) {
        this._portWait = port;
    }
  
    /**
     * @return the m_Group
     */
    public MulticastSocket getM_Group() {
        return m_Group;
    }

    /**
     * @param m_Group the m_Group to set
     */
    public void setM_Group(MulticastSocket m_Group) {
        this.m_Group = m_Group;
    }
    
      
    public InitializationBroadCastGroup(String ipAddress, int portwait)
    {
        try
        {
            _group = InetAddress.getByName(ipAddress);
            m_Group = new MulticastSocket(portwait);
            _portWait = portwait;
        }
        catch (Exception e)
        {
            
        }  
    }
    
    public boolean Initialize()
    {
        try
        {
            m_Group.joinGroup(_group);
        }
        catch (Exception e)
        {
            return false;
        }
        return true;
    }
}
